package cn.zwk.handler;

import cn.zwk.handler.impl.HttpHandler;
import cn.zwk.handler.impl.ShHandler;

public final class HandlerFactory {
    private HandlerFactory() {}

    public static Handler create(String type) {
        if (type == null) throw new IllegalArgumentException("handler type is null");
        return switch (type.toLowerCase()) {
            case "sh" -> new ShHandler();
            case "http" -> new HttpHandler();
            default -> throw new IllegalArgumentException("unsupported handler type: " + type);
        };
    }
}

